package com.api.gbhg.daiyanlu.DataPrintCopyUtil;

import com.api.gbhg.liwenjun.VersionFlowUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.conn.RecordSet;

public class CommonMethod {
    public static final Logger LOGGER= LoggerFactory.getLogger(CommonMethod.class);
    //修改预算总金额
    public static boolean updateTotalBudgetAmount(String requestid,String workFlowId){
        String flowTableName = VersionFlowUtil.getFlowTableName(workFlowId);
        RecordSet rs = new RecordSet();
        String StrSQL = "select * from "+flowTableName+"_dt2 where mainid="+"(select id from "+flowTableName+" where requestid=" + requestid+")"; //获取明细条1
        rs.executeQuery(StrSQL);
        LOGGER.info("-----------------修改预算总金额"+StrSQL+"------------------------");
        double yszje =0;
        while (rs.next()){
            yszje=yszje+rs.getDouble("hjwy");
        }
        RecordSet rsupd= new RecordSet();
        String sqlUpd ="update uf_jingfei_version set yszje="+yszje+" where requestId="+requestid;
        boolean falg = rsupd.executeUpdate(sqlUpd);
        return falg;
    }
}
